<?php

class ORMDBConnection extends ORMConnection {

  const DB_MYSQL = "mysql";

  protected $initialCommand;
  protected $transaction = false;

  public function connect() {
    if( $this->connection == null ) {
        if( empty( $this->initialCommand) ) $this->connection = new PDO($this->connectionString, $this->user, $this->password ) ;
        else $this->connection = new PDO($this->connectionString, $this->user, $this->password, array(PDO::MYSQL_ATTR_INIT_COMMAND => $this->initialCommand));
    }
  }


  public function closeConneciton() {
  
  }

  public function isConnected() {}

  



  public static function buildConnectionString( $type, $host, $dbName ) {

  }
  
  public function setInitialCommand( $command ) {
          $this->initialCommand = $command;
  }

  public function setConnectionString( $host, $dbName, $port = 3305, $type = self::DB_MYSQL ) {
        $this->connectionString = $type.":host=$host;dbname=$dbName;port=$port" ;
  } 

  /* return IORM Collection */
  public function query( $query ) {
          
  }
    
    // do wykonywania insertow, deletow i updatow
    // zwraca ilosc dodanych, usunietych lub zmodyfikowanych rekordow
   public function execute( $query )  {
   
   }
      
      // uruchomienie profailera
      
      // ustawienie bledow
      
      // $pdo -> setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);


    public abstract function beginTransaction() ;


    public abstract function commit();


    public abstract function rollback();


}

?>
